package com.dht.xiao.jianye.adapter;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.dht.xiao.jianye.R;

import cn.dlc.commonlibrary.ui.adapter.BaseRecyclerAdapter;

/**
 * 用于缓存图片
 */
public class DiskCacheAdapter extends BaseRecyclerAdapter<String> {
    Context context;
    @Override
    public int getItemLayoutId(int viewType) {
        return R.layout.item_verify_diskcache;
    }
    public DiskCacheAdapter(Context context) {
        this.context = context;
    }

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    @Override
    public void onBindViewHolder(CommonHolder holder, int position) {

        Glide.with(context).load(getItem(position)).apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.RESOURCE).
                error(R.mipmap.btn_blue_nor)).into(holder.getImage(R.id.icon));

    }
}
